<template>
  <div class="projectDetailContainer">
		<div class="ai">
			<minAi url="/ai/dify/system/chat/chatMessages" />
		</div>
		<div class="content">
			<div class="topBox">
				<a-breadcrumb >
					<a-breadcrumb-item>
						<router-link :to="`/stu`">{{ t('menu','首页') }}</router-link>
					</a-breadcrumb-item>
					<a-breadcrumb-item>
						{{ route.query.name }}
					</a-breadcrumb-item>
				</a-breadcrumb>
			</div>
			
			<learnProjectDetail v-model:currentData="currentData" @handleClick="handleClick" />
		</div>
	</div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'
import { reactive, ref, watch, h, provide } from 'vue'
import minAi from '@/components/common/minAi.vue'
import learnProjectDetail from '@/components/student/learnProjectDetail.vue';
import { studentLearningFindById } from '@/request/stu/learnProcess'
import { learningFindById } from '@/request/teacher/project/learn'
import { isTeacher } from '@/stores/info'
import { t } from '@/i18n'

const route = useRoute()
const router = useRouter()
if (route.query.name && route.query.id) sessionStorage.setItem('pojectInfo', JSON.stringify(route.query))
let pojectInfo = JSON.parse(sessionStorage.getItem('pojectInfo') || '{}')
provide('pojectInfo', pojectInfo)



const currentData = ref({})
const show = async () => {
	let res = null
	if (isTeacher()) {
		res = await learningFindById(pojectInfo)
	} else res = await studentLearningFindById(route.query.id)
	if (!res) return
	currentData.value = res.data
}
show()
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
  min-height: 0;
  min-width: 0;
}
.projectDetailContainer {
	height: 100%;
	flex: 1;
	width: $viewMinWidth;
	display: flex;
	justify-content: space-between;
	.ai {
		height: 100%;
		display: flex;
		flex-direction: column;
		padding: 0px 0 30px 0 ;
		width: 430px;
		min-height: 0;
		padding-top: 30px;
	}
	.content {
		display: flex;
		flex-direction: column;
		/* background: #fff; */
		border-radius: 8px;
		flex: 1;
		margin: 30px 0 30px 24px;
		.topBox {
			margin-bottom: 10px;
		}
	}
}
</style>
